package com.logisticsinquiry.android.logic.dao

import androidx.room.*
import com.logisticsinquiry.android.logic.entity.ShipperCodeResponseHistory


@Dao
interface ShipperCodeResponseHistoryDao {
    @Insert
    fun insertShipperCodeResponseHistory(shipperCodeResponseHistory: ShipperCodeResponseHistory): Long

    @Update
    fun updateShipperCodeResponseHistory(newShipperCodeResponseHistory: ShipperCodeResponseHistory)


    @Query("select * from ShipperCodeResponseHistory where username = :username order by id desc")
    fun loadAllShipperCodeResponseHistorys(username: String): List<ShipperCodeResponseHistory>

    @Query("select * from ShipperCodeResponseHistory where logisticCode = :code and username = :username")
    fun loadShipperCodeResponseHistoryByLogisticCode(code: String, username: String): ShipperCodeResponseHistory

    @Delete
    fun deleteShipperCodeResponseHistory(shipperCodeResponseHistory: ShipperCodeResponseHistory)

    @Query("delete from ShipperCodeResponseHistory where logisticCode = :LogisticCode AND username = :username")
    fun deleteShipperCodeReponseHistoryBySomething(LogisticCode:String, username: String) : Int


}
